package com.whj.apipassenger.service.impl;

import com.whj.apipassenger.remote.ServiceOrderClient;
import com.whj.apipassenger.service.OrderService;
import com.whj.internalcommon.constant.IdentityConstant;
import com.whj.internalcommon.dto.ResponseResult;
import com.whj.internalcommon.request.OrderRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Auther: wanghaijun
 * @Date: 2023/1/28 - 01 - 28 - 15:04 
 * @Description: com.whj.apipassenger.service.impl
 */

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private ServiceOrderClient serviceOrderClient;

    /**
     * 调用 service—order 服务实现创建订单
     *
     * @param orderRequest
     * @return
     */
    @Override
    public ResponseResult orderAdd(OrderRequest orderRequest) {
        return serviceOrderClient.orderAdd(orderRequest);
    }

    @Override
    public ResponseResult cancel(Long orderId) {
        serviceOrderClient.cancel(orderId, IdentityConstant.PASSENGER_IDENTITY);
        return ResponseResult.success("");
    }
}
